/**
 * 引入 ElementUI
 */
import Vue from 'vue'

// 全量引入
// import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
// Vue.use(ElementUI)

// 按需引入
import {
  Message,
  MessageBox,
  Loading,
  Row,
  Col,
  Form,
  FormItem,
  Input,
  DatePicker,
  Select,
  Option,
  Tag,
  Button,
  Tooltip,
  Dropdown,
  DropdownMenu,
  DropdownItem,
  Dialog,
  Pagination,
  Table,
  TableColumn,
  Breadcrumb,
  BreadcrumbItem,
  Tabs,
  TabPane,
  Divider,
  Card,
  Notification,
  Link,
  Checkbox,
  RadioGroup,
  Radio,
  Cascader,
  InputNumber,
  Tree,
  Upload
} from 'element-ui'
Vue.use(Button)
Vue.use(Tooltip)
Vue.use(Dropdown)
Vue.use(DropdownMenu)
Vue.use(DropdownItem)
Vue.use(DatePicker)
Vue.use(Row)
Vue.use(Col)
Vue.use(Pagination)
Vue.use(Form)
Vue.use(Card)
Vue.use(FormItem)
Vue.use(Select)
Vue.use(Option)
Vue.use(Input)
Vue.use(Tag)
Vue.use(Dialog)
Vue.use(Table)
Vue.use(Divider)
Vue.use(TableColumn)
Vue.use(Breadcrumb)
Vue.use(BreadcrumbItem)
Vue.use(Tabs)
Vue.use(TabPane)
Vue.use(Link)
Vue.use(Checkbox)
Vue.use(RadioGroup)
Vue.use(Radio)
Vue.use(Cascader)
Vue.use(InputNumber)
Vue.use(Tree)
Vue.use(Upload)

const { directive: loadingDirective, service: loadingService } = Loading
Vue.use(loadingDirective)
Vue.prototype.$loading = loadingService
Vue.prototype.$message = Message
Vue.prototype.$success = msg =>
  Message({
    message: msg,
    type: 'success'
  })
Vue.prototype.$warning = msg =>
  Message({
    message: msg,
    type: 'warning'
  })
Vue.prototype.$error = msg => Message.error(msg)
const msgbox = MessageBox
const { alert, confirm, prompt } = msgbox
Vue.prototype.$alert = alert
Vue.prototype.$confirm = confirm
Vue.prototype.$prompt = prompt
Vue.prototype.$notify = Notification
